// AddCamera.cpp : implementation file
//

#include "stdafx.h"
#include "Measure.h"
#include "CameraAdd.h"
#include "afxdialogex.h"


// CAddCamera dialog

IMPLEMENT_DYNAMIC(CCameraAdd, CDialogEx)

CCameraAdd::CCameraAdd(CWnd* pParent /*=NULL*/)
	: CDialogEx(CCameraAdd::IDD, pParent)
  , name_(_T("camera0"))
  , camera_interface_(0)
  , camera_sdk_(0)
{

}

CCameraAdd::~CCameraAdd()
{
}

void CCameraAdd::DoDataExchange(CDataExchange* pDX)
{
  CDialogEx::DoDataExchange(pDX);
  DDX_Text(pDX, IDC_CAMERA_NMAE, name_);
  DDV_MaxChars(pDX, name_, 128);
  DDX_Control(pDX, IDC_CAMERA_INTERFACE, wnd_camera_interface_);
  DDX_Control(pDX, IDC_CAMERA_SDK, wnd_camera_sdk_);
  DDX_CBIndex(pDX, IDC_CAMERA_INTERFACE, camera_interface_);
  DDX_CBIndex(pDX, IDC_CAMERA_SDK, camera_sdk_);
}


BEGIN_MESSAGE_MAP(CCameraAdd, CDialogEx)
  ON_CBN_SELCHANGE(IDC_CAMERA_INTERFACE, &CCameraAdd::OnSelchangeCameraInterface)
END_MESSAGE_MAP()


// CAddCamera message handlers


BOOL CCameraAdd::OnInitDialog()
{
  CDialogEx::OnInitDialog();

  wnd_camera_interface_.AddString(_T("IIDC1394A"));
  wnd_camera_interface_.AddString(_T("IIDC1394B"));
  wnd_camera_interface_.AddString(_T("GigE Vision"));
  wnd_camera_interface_.SetCurSel(camera_interface_);

  wnd_camera_sdk_.AddString(_T("Halcon IIDC1394"));
  wnd_camera_sdk_.AddString(_T("Function-Tech FCAM"));
  wnd_camera_sdk_.SetCurSel(camera_sdk_);

  return TRUE;
}


void CCameraAdd::OnSelchangeCameraInterface()
{
  UpdateData(TRUE);

  wnd_camera_sdk_.ResetContent();

  switch (camera_interface_)
  {
  case 0:
    wnd_camera_sdk_.AddString(_T("Halcon IIDC1394"));
    wnd_camera_sdk_.AddString(_T("Function-Tech FCAM"));
    wnd_camera_sdk_.AddString(_T("AVT FireGrab"));
    break;

  case 1:
    wnd_camera_sdk_.AddString(_T("Halcon IIDC1394"));
    wnd_camera_sdk_.AddString(_T("AVT FireGrab"));
    break;

  case 2:
    wnd_camera_sdk_.AddString(_T("Halcon GigEVision"));
    break;

  default:
    break;
  }

  camera_sdk_ = 0;

  UpdateData(FALSE);
}
